package com.rd.student.jike.class2.xuezhixin.day0731;

import com.rd.student.jiaji.class4.suyan.HashMap1;
import com.rd.student.jiaji.class4.suyan.zrrd.homework.水仙花;

import java.util.HashSet;

public class Work06 {

    // set 方法

    public static void main(String[] args) {

        int[] arr = new int[50];
        for(int i = 0;i<50;i++){
            arr[i] = i;
        }

        HashSet<Integer> set = new HashSet<>();

        while (set.size()<20){
            int subscript = (int) (Math.random() * arr.length);
            set.add(arr[subscript]);
        }

        System.out.println(set);
        System.out.println(set.size());
    }
}
